package com.test;

import java.util.concurrent.TimeUnit;

public class T01_Hellovolatile {

    volatile boolean running = true;

    void m(){
        System.out.println(" m start");
        while(running){

        }
        System.out.println("m end");
    }

    public static void main(String[] args) {
        T01_Hellovolatile t = new T01_Hellovolatile();
        new Thread( t::m).start();
        try {
            TimeUnit.SECONDS.sleep(1L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        t.running =false;
    }
}
